﻿<UserControl
    x:Class="MDT_Metro_monitoring.ServerManagementSettings"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MDT_Metro_monitoring"
    xmlns:data="using:MDT_Metro_monitoring.Data"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignWidth="646">

    <UserControl.Resources>
        <CollectionViewSource x:Name="serverSource" IsSourceGrouped="True"/>
    </UserControl.Resources>
    
    <Grid Style="{StaticResource LayoutRootStyle}"  Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="80"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid Background="DarkCyan" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource SnappedBackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Grid.Column="1" Style="{StaticResource SettingsHeaderTextStyle}"/>
            <Image Source="Assets/MDT MonitorLogoSmall.png" HorizontalAlignment="Right" Grid.Column="2" Height="24" Width="24" Margin="0,0,6,0" />


        </Grid>

        <Grid HorizontalAlignment="Left" Margin="10,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="626">
            <Grid.RowDefinitions>
                <RowDefinition Height="225"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Left" Foreground="DarkCyan" Grid.Row="0" Margin="26,19,0,0" TextWrapping="Wrap" Text="Ip or Name:" VerticalAlignment="Top" FontSize="16"/>
                <TextBox x:Name="ipName" Grid.Row="0" HorizontalAlignment="Left" Margin="149,10,0,0" TextWrapping="Wrap" Text="Ip or Name" VerticalAlignment="Top" Width="395" BorderBrush="#FFDAD4D4"/>
                
                <TextBlock HorizontalAlignment="Left" Foreground="DarkCyan" Grid.Row="1" Margin="26,19,0,0" TextWrapping="Wrap" Text="Port number:" VerticalAlignment="Top" FontSize="16"/>
                <TextBox x:Name="port" Grid.Row="1" HorizontalAlignment="Left" Margin="149,10,0,0" TextWrapping="Wrap" Text="9801" VerticalAlignment="Top" Width="120" BorderBrush="#FFDAD4D4"/>
                
                <Button Content="Remove" x:Name="removeButton" Grid.Row="2" Foreground="DarkCyan" BorderBrush="#FFDAD4D4" HorizontalAlignment="Left" Margin="424,10,0,0" VerticalAlignment="Top" Click="removeSrvClicked" ClickMode="Press"/>
                <Button Content="Add" x:Name="addButton" Grid.Row="2" Foreground="DarkCyan" BorderBrush="#FFDAD4D4" HorizontalAlignment="Left" Margin="529,10,0,0" VerticalAlignment="Top" Click="addSrvClicked"/>
               
            </Grid>
                                
            <GridView Grid.Row="1" 
                x:Name="srvListGridView"
                Margin="57,10,69,46"
                ItemsSource="{Binding Source={StaticResource serverSource}}"
                ItemTemplate="{StaticResource ServerSettingsItemTemplate}"
                IsItemClickEnabled="True"
                ItemClick="serverItemclicked"
                SelectionMode="Multiple" 
                SelectionChanged="srvListGridView_SelectionChanged">

                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
                <GridView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <VariableSizedWrapGrid Orientation="Horizontal" Margin="0,0,80,0"/>
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </GridView.GroupStyle>
            </GridView>

        </Grid>        
    </Grid>
</UserControl>
